SERVO MOTOR INTERFACING WITH PIC
Servo Motors are used where precise control on angular motion is needed.
Synopsis

A Servo is a small device that has an output shaft. This shaft can be positioned to specific angular positions by sending the servo a coded signal. As long as the coded signal exists on the input line, the servo will maintain the angular position of the shaft. As the coded signal changes, the angular position of the shaft changes. Servo Motors are used where precise control on angular motion is needed. In practice, Servo’s are used in radio controlled airplanes to position control surfaces like the elevators and rudders. They are also used in radio controlled cars, puppets, and of course, robots.

Description

A Servo motor has three wire Terminals : two of these wires are to provide ground and positive supply to the Servo DC motor, while the third wire is for the control signal. These wires of a servo motor are color coded. The servo motor can be driven only when PWM (pulse width modulated) signals are provided to the control terminal.

Simply connect the black wire to ground, the red to a 4.8-6V source, and the yellow/white wire to a signal generator (such as from your PIC18F4550 microcontroller). Vary the square wave pulse width from 1-2 ms and your servo is now position/velocity controlled.

The total pulse duration for a typical servo motor should be of 20 milliseconds. The on-time duration of the control signal varies from 1ms to 2ms. This on-time variation provides angular variation from 0 to 180 degree.

Servos are DC motors with built in gearing and feedback control loop circuitry. And no motor drivers required. They are extremely popular with robot, RC plane, and RC boat builders. Most servo motors can rotate about 90 to 180 degrees. Some rotate through a full 360 degrees or more.

Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a processor's digital outputs. The general concept is to simply send an ordinary logic square wave to your servo at a specific wave length, and your servo goes to a particular angle. The wavelength directly maps to servo angle.


180° angular displacement is achieved by the pulse duration = 1 ms

1° angular displacement is achieved by the pulse duration of = 1 /180 ms

45° angular displacement is achieved by the pulse duration of = (1/180) x 45 = 0.25 ms

So total on-time pulse will be = 1ms + 0.25ms =1.25 ms

Types of Servo Motor

Servo motors are classified into different types based on their application, such as AC servo motor, DC servo motor, brushless DC servo motor, positional rotation, continuous rotation and linear servo motor etc. Typical servo motors comprise of three wires namely, power control and ground. The shape and size of these motors depend on their applications. RC servo motor is the most common type of servo motor used in hobby applications, robotics due to their simplicity, affordability and reliability of control by microprocessors.

DC Servo Motor


The motor which is used as a DC servo motor generally have a separate DC source in the field of winding & armature winding. The control can be archived either by controlling the armature current or field current. Field control includes some particular advantages over armature control. In the same way armature control includes some advantages over field control. Based on the applications the control should be applied to the DC servo motor. DC servo motor provides very accurate and also fast respond to start or stop command signals due to the low armature inductive reactance. DC servo motors are used in similar equipments and computerized numerically controlled machines.

AC Servo Motor


AC servo motor is an AC motor that includes encoder is used with controllers for giving closed loop control and feedback. This motor can be placed to high accuracy and also controlled precisely as compulsory for the applications. Frequently these motors have higher designs of tolerance or better bearings and some simple designs also use higher voltages in order to accomplish greater torque. Applications of an AC motor mainly involve in automation, robotics, CNC machinery, and other applications a high level of precision and needful versatility.

Basic working concept of servo motors

A servo motor consists of a DC motor, reduction gearbox, positional feedback device and some form of error correction. The speed or position is controlled in relation to a positional input signal or reference signal applied to the device.

The error detection amplifier looks at this input signal and compares it with the feedback signal from the motors output shaft and determines if the motor output shaft is in an error condition and, if so, the controller makes appropriate corrections either speeding up the motor or slowing it down. This response to the positional feedback device means that the servo motor operates within a “Closed Loop System”.


As well as large industrial applications, servo motors are also used in small remote control models and robotics, with most servo motors being able to rotate up to about 180 degrees in both directions making them ideal for accurate angular positioning. However, these RC type servos are unable to continually rotate at high speed like conventional DC motors unless specially modified.

A servo motor consist of several devices in one package, the motor, gearbox, feedback device and error correction for controlling position, direction or speed. They are widely used in robotics and small models as they are easily controlled using just three wires, Power, Ground and Signal Control.

Applications

• The servo motor is used in robotics to activate movements, giving the arm to its precise angle.

• The servo motor is built into the camera to correct a lens of the camera to improve out of focus images.

• The servo motor is used in robotic vehicle to control the robot wheels, producing plenty torque to move, start and stop the vehicle and control its speed.

• The Servo motor is used in Textiles to control spinning and weaving machines, knitting machines and looms.

• The Servo motor is used in automatic door openers to control the door in public places like supermarkets, hospitals and theatres.

Proteus design for Servo Motor interfacing with PIC


Orcad design for Servo Motor interfacing with PIC


Servo Motor interfacing with PIC

/*  Name     : main.c
 *  Purpose  : Source code for SERVO MOTOR Interfacing with PIC18F4550.
 *  Author   : Gemicates
 *  Date     : 2017-06-22
 *  Website  : www.gemicates.org
 *  Revision : None
 */
#include<xc.h>                     // Header file for PIC18F4550
#define _XTAL_FREQ 12000000        // 12MHZ

void delay_ms();
void delay_us();
unsigned int i;
void main()
{  
    
 CMCON = 0x07;                     // To turn off comparators  
 ADCON1 = 0x0F;                    // A/D control register
 TRISC = 0x00;                     // PORTC as output
 while(1) {
      for(i=0;i<49;i++)            // rotate to 0 degree 
        {  
          PORTCbits.RC0=1;       
        __delay_us(900);  
          PORTCbits.RC0=0;  
        __delay_us(19100);  
        }   
       __delay_ms(20);             // delay for 0.02 sec  
    
         {
     for(i=0;i<49;i++)             // rotate to 45 degree 
        {
          PORTCbits.RC0=1;         
        __delay_us(1250);  
          PORTCbits.RC0=0;  
        __delay_us(18750);  
        }   
        __delay_ms(20);            // delay for 0.02 sec  
  
         {
     for(i=0;i<49;i++)             // rotate to 90 degree 
        {  
          PORTCbits.RC0=1;  
        __delay_us(1500);  
          PORTCbits.RC0=0;  
        __delay_us(18500);  
        }  
        __delay_ms(20);            // delay for 0.02 sec  
   
          {
     for(i=0;i<49;i++)             // rotate to 1350 degree 
        {  
          PORTCbits.RC0=1;  
        __delay_us(1750);  
          PORTCbits.RC0=0;  
        __delay_us(18250);  
        }  
        __delay_ms(20);            // delay for 0.02 sec  
      
          {
     for(i=0;i<49;i++)             // rotate to 180 degree
        {  
          PORTCbits.RC0=1;  
        __delay_us(2000);  
          PORTCbits.RC0=0;  
        __delay_us(18000);  
        }  
        __delay_ms(20);            // delay for 0.02 sec  
          }  
        }
      }
    }
  }
 
}

Error message here!

Show Error message here!


Forgot your password?

Error message here!

Send OTP

Error message here!

Show Error message here!


Lost your password? Please enter your email address. You will receive a password you Need.

Send Error message here!


Back to log-in

Close